package com.roc.service.impl.transReport;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.roc.dao.DaoException;
import com.roc.dao.agent.IAgentInfoDao;
import com.roc.dao.transReport.ITransReportDao;
import com.roc.pojo.CalcuBean;
import com.roc.pojo.Esmidinfo;
import com.roc.pojo.TransReport;
import com.roc.service.ServiceException;
import com.roc.service.impl.AgentInfoServiceImpl;
import com.roc.service.transReport.ITransReportService;
@Service
@Transactional
public class TransReportServiceImpl implements ITransReportService{
	static Logger logger=Logger.getLogger(TransReportServiceImpl.class);
	@Autowired
	private ITransReportDao transReportDao;
	
	
	@Override
	public List<CalcuBean> queryTrans(String merchantNO, String date)
			throws ServiceException {
		// TODO Auto-generated method stub
		List<CalcuBean> calcuList;
		try{
			calcuList=transReportDao.queryTrans(merchantNO, date);
		}catch(DaoException e){
			logger.debug(e.getMessage(), e);
			throw new ServiceException("获取交易明细信息失败");
		}
		return calcuList;
	}

	@Override
	public TransReport queryTransReportById(Long id) throws ServiceException {
		// TODO Auto-generated method stub
		TransReport transReport;
		try{
			transReport=(TransReport) transReportDao.loadById(id, TransReport.class);
		}catch(DaoException e){
			logger.debug(e.getMessage(), e);
			throw new ServiceException("获取交易信息失败");
		}
		return transReport;
	}

	@Override
	public Esmidinfo queryMerinfo(String merchantNo) throws ServiceException {
		// TODO Auto-generated method stub 
		Esmidinfo mrinfo;
		try{
			mrinfo=transReportDao.queryMerinfo(merchantNo);
		}catch(DaoException e){
			logger.debug(e.getMessage(), e);
			throw new ServiceException("获取商户信息失败");
		}
		return mrinfo;
	}

}
